/*************************************************************************
	> File Name: selection_sort.cpp
	> Author: 
	> Mail: 
	> Created Time: Mon 05 Aug 2024 12:44:00 PM CST
 ************************************************************************/

#include <cstdio>
#include <cstdlib>
#include "0.sort_test.h"

void selectionSort(int *arr, int l, int r) {
    for(int i = l; i < (r - 1); i++) {
        int ind = i;
        for(int j = i + 1; j < r; j++) {
            if(arr[j] < arr[ind]) ind = j;
        }
        swap(arr[i], arr[ind]);
    }
    return ;
}

int main() {
    int *arr = getRandData(SMALL_DATA);
    TEST(selectionSort, arr, SMALL_DATA);
    free(arr);
    return 0;
}
